﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<zeus.Core.Test>" %>

<script language="javascript" type="text/javascript">
    function processJson(data) {
        $.nyroModalRemove();
        document.location.href = "/Test/ListaMejorada";
    }

    $('form').ajaxForm({
        dataType: 'json',
        success: processJson,
        beforeSubmit: function (arr, $form, options) {
            return $form.validate().form();
        }
    });
</script>

<% Html.EnableClientValidation(); %>

    <% using (Html.BeginForm("CreateTest", "Test", FormMethod.Post, new { id = "testForm" })) {%>
    
    <%= Html.ValidationSummary(false)%>

    <div class="editor-label">
        <%= Html.LabelFor(model => model.Nombre) %>
    </div>
    <div class="editor-field">
        <%= Html.TextBoxFor(model => model.Nombre) %>
        <%= Html.ValidationMessageFor(model => model.Nombre) %>
    </div>
            
    <div class="editor-label">
        <%= Html.LabelFor(model => model.Direccion) %>
    </div>
    <div class="editor-field">
        <%= Html.TextBoxFor(model => model.Direccion) %>
        <%= Html.ValidationMessageFor(model => model.Direccion) %>
    </div>
            
    <div class="editor-label">
        <%= Html.LabelFor(model => model.Telefono) %>
    </div>
    <div class="editor-field">
        <%= Html.TextBoxFor(model => model.Telefono) %>
        <%= Html.ValidationMessageFor(model => model.Telefono) %>
    </div>
                                    
    <p>
        <input type="submit" value="Create" id="createButton" />
    </p>
    
<% } %>


<script type="text/javascript">
    RefreshClientValidationMetadata();
</script>